<%
layout("/layouts/platform.html"){
%>
<header class="header navbar bg-white shadow">
    <div class="btn-group tool-button">
        <a class="btn btn-primary navbar-btn" href="${base}/platform/losys/GroupPricesetting" id="goback" data-pjax><i class="ti-angle-left"></i> 返回</a>
    </div>
</header>

<div class="content-wrap">
    <div class="wrapper" style="min-height:500px;">
        <section class="panel panel-form">
            <form id="addForm" role="form" class="form-horizontal parsley-form" data-parsley-validate
                  action="${base}/platform/losys/GroupPricesetting/editDo" method="post">
                <div class="row mb10">
                    <div class="col-lg-12">
                        <div class="form-group">
                        <input type="hidden" value="${obj.id!}" name="id">
                        <input type="hidden" value="${obj.groupId!}" name="groupId">
                        <input type="hidden" value="${obj.opAt!}" name="opAt">
                       		<label for="site_icp" class="col-sm-2 control-label">运算符</label>
                           	<div class="col-sm-8">
					        <select id="operator" name="operator" class="form-control">
					        	<% if(obj.operator=='>') {%> 
					            <option value=">" selected="selected">大于</option>
					            <option value="<">小于</option>
					            <option value=">=">大于等于</option>
					            <option value="<=">小于等于</option>
					            <option value="min">最低</option>
					            <option value="max">最高</option>  
					          	<%}else if(obj.operator=='<') {%>  
					          	<option value=">">大于</option>
					            <option value="<" selected="selected">小于</option>
					            <option value=">=">大于等于</option>
					            <option value="<=">小于等于</option>
					            <option value="min">最低</option>
					            <option value="max">最高</option>  
					          	<%}else if(obj.operator=='>=') {%>  
					          	<option value=">">大于</option>
					            <option value="<">小于</option>
					            <option value=">=" selected="selected">大于等于</option>
					            <option value="<=">小于等于</option>
					            <option value="min">最低</option>
					            <option value="max">最高</option> 
					          	<%}else if(obj.operator=='<=') {%>  
					          	<option value=">">大于</option>
					            <option value="<">小于</option>
					            <option value=">=">大于等于</option>
					            <option value="<=" selected="selected">小于等于</option>
					            <option value="min">最低</option>
					            <option value="max">最高</option> 
					            <%}else if(obj.operator=='min') {%>  
					          	<option value=">">大于</option>
					            <option value="<">小于</option>
					            <option value=">=">大于等于</option>
					            <option value="<=">小于等于</option>
					            <option value="min" selected="selected">最低</option>
					            <option value="max">最高</option> 
					            <%}else if(obj.operator=='max') {%>  
					          	<option value=">">大于</option>
					            <option value="<">小于</option>
					            <option value=">=">大于等于</option>
					            <option value="<=">小于等于</option>
					            <option value="min">最低</option>
					            <option value="max" selected="selected">最高</option> 
					          	<%}%>
					        </select>
					        </div>
                    	</div>
                    	<div class="form-group">
                            <label for="name" class="col-sm-2 control-label">重量（kg）</label>

                            <div class="col-sm-8">
                                <input type="text" id="weight" class="form-control" name="weight" data-parsley-required="true" value="${obj.weight!}"
                                data-parsley-pattern="^(([0-9]+\.[0-9]*[0-9][0-9]*)|([0-9]*[0-9][0-9]*\.[0-9]+)|([0-9]*[0-9][0-9]*))$"
                                       placeholder="重量（kg）">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">价格</label>

                            <div class="col-sm-8">
                                <input type="text" id="price" class="form-control" name="price" data-parsley-required="true" value="${obj.price!}"
                                data-parsley-pattern="^(([0-9]+\.[0-9]*[0-9][0-9]*)|([0-9]*[0-9][0-9]*\.[0-9]+)|([0-9]*[0-9][0-9]*))$"
                                       placeholder="价格">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label">低消</label>

                            <div class="col-sm-8">
                                <input type="text" id="min" class="form-control" name="min" data-parsley-required="true"  value="${obj.min!}"
                                data-parsley-pattern="^(([0-9]+\.[0-9]*[0-9][0-9]*)|([0-9]*[0-9][0-9]*\.[0-9]+)|([0-9]*[0-9][0-9]*))$"
                                       placeholder="低消">
                            </div>
                        </div>
                    
                </div>
                </div>
                <div class="col-lg-3"></div>
                <div class="col-lg-6">
                    <div class="form-group text-center">
                        <label></label>

                        <div>
                            <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
                        </div>
                    </div>
                </div>
            </form>
        </section>

    </div>
</div>
<script language="JavaScript">
	function clearFile() {
	    $("#imgs").html("");
	    $("#queue").html("");
	    $("#img").val("");
	    
	}
	

    $(document).ready(function () {
    	var ue;
    	setTimeout(function () {
            ue= new baidu.editor.ui.Editor();
            ue.render('detail');
        },500);
    	
    	 $('#file_upload').uploadifive({
             'auto': true,
             'multi': false,
             'width': '100%',
             'height': '35',
             'buttonText': '请选择图片',
             'fileType': 'image/jpg,image/jpeg,image/png',
             'fileSizeLimit': 1024,
             'queueSizeLimit': 1,
             'formData': {},
             'queueID': 'queue',
             'uploadScript': '${base}/open/file/upload/image',
             'onUploadComplete': function (file, data) {
                 data = JSON.parse(data);
                 if (data.code == 0) {
                     Toast.success(data.msg);
                     $("#imgs").html("<img src='" + data.data + "' style='width:150px;'>");
                     $("#img").val(data.data);
                 } else {
                     clearFile();
                     Toast.error(data.msg);
                 }
             },
             'onDrop': function (file, fileDropCount) {
                 clearFile();
             },
             'onClearQueue': function (queue) {
                 clearFile();
             },
             'onCancel': function () {
                 clearFile();
             }
         });
    	
    	
        $('#addForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code == 0) {
                    Toast.success(data.msg);
                    /* //刷新父级菜单
                    form.resetForm(); */
                    setTimeout(function () {
                        $("#goback").trigger("click");
                    }, 1000);
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
    });
</script>


<%}%>